package com.hl.sfzy.controller;

import com.hl.sfzy.entity.Consult;
import com.hl.sfzy.service.ConsultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/my/consult")
public class ConsultController1 {
    @Autowired
    private ConsultService consultService;

    @GetMapping("/getConsult1")
    public ResponseEntity<Map<String, Object>> getConsult(
            @RequestParam Integer userId,
            @RequestParam Integer pageNo,
            @RequestParam Integer pageSize) {
        List<Consult> consults = consultService.getConsultsByUserId(userId, pageNo, pageSize);

        Map<String, Object> response = new HashMap<>();
        response.put("data", consults);
        return ResponseEntity.ok(response);
    }
}